Skip to main content

Seed data

Seed Data Creation

The Seed Data Creation interface allows you to define and manage seed data for your database tables. Seed data is essential for initializing your database with predefined records that can be used for testing, development, or production. This interface helps you easily create, update, and delete seed data across different tables in your connected database.

Benefits of Seed Data Creation
  • Quick Initialization: Seed data helps in quickly populating tables with predefined values, making development and testing more efficient.
  • Flexibility: You can manage seed data across multiple tables and databases, ensuring that your data is aligned with the correct schema.
  • Control: The interface provides easy access to edit, add, and delete seed data, giving you full control over the records.
  • Easy Management: With action buttons for adding, editing, and deleting data, you can easily manage multiple entries without manually interacting with the database.

By using the Seed Data Creation interface, users can efficiently manage the data needed to initialize their tables for development, testing, or even production environments.

Interface Overview

  1. Name Field:

    • This field allows you to assign a name to the seed data you are creating.
    • The name helps you organize and identify the seed data, especially if you are managing multiple sets of data across various tables.
    • Example: In the first image, you can assign names like EmployeeSeedData or ProductSeedData.
  2. Connection:

    • This dropdown allows you to choose the database connection where the seed data will be inserted.
    • In the provided image, the connection is set to EmployeDetailsdbDevelopment, which indicates that the seed data will be created for this particular database.
    • You can select different connections based on the environment you are working in (e.g., development, production).
  3. SelectTable:

    • After selecting the connection, you must choose the specific table from the connected database where the seed data will be applied.
    • This ensures that the seed data corresponds to the correct table structure, and you can add seed data that aligns with the columns of the selected table.
    • Example: You can select tables like employees, products, or orders depending on your requirements.
  4. Resources Section:

    • This section displays the list of existing seed data entries for the selected table. Each resource entry includes fields such as id, userid, and role, which are specific to the selected table.
    • In the second image, there are two seed data resources (Name and Name 2), and each resource has editable fields like id, userid, and role.
    • The Action column provides options for editing, adding, or deleting seed data entries.

Action Buttons

  1. Add New Seed Data:

    • Click the Add New Property button to add a new seed data entry.
    • This opens the seed data form where you can input data values for the fields in the selected table.
  2. Edit Seed Data:

    • The Edit button (represented by the pencil icon) allows you to modify an existing seed data entry.
    • Once clicked, the data fields become editable, and you can update the values as needed.
  3. Add Row:

    • The + button allows you to add additional rows to the seed data. Each row represents a new record in the table.
  4. Delete Seed Data:

    • The Delete button (represented by the trash icon) allows you to remove a seed data entry from the list.
    • This is useful when you want to remove old or incorrect seed data.
  5. Save/Cancel:

    • Once you have added or modified seed data, use the Save button to apply the changes to the database.
    • If you want to discard your changes, click the Cancel button to revert the modifications.

Example Seed Data Creation Process:

  1. Name: EmployeeSeedData

  2. Connection: EmployeDetailsdbDevelopment

  3. SelectTable: employees

  4. Add Seed Data:

    • Add new entries for the employees table with the following fields:
      • id: 1
      • userid: emp_001
      • role: Manager
      • Save the entry.
  5. Edit Seed Data:

    • Modify an existing seed data entry, for example, change the role of the user with id 1 to Admin.
    • Save the changes.
  6. Delete Seed Data:

    • If a seed data entry is no longer needed, delete the entry by clicking the trash icon.

Summary

The Seed Data Creation interface provides an intuitive way to manage seed data for your database tables. It simplifies the process of initializing tables with predefined values, whether for development, testing, or production. With features like easy table selection, flexible data entry, and full control over adding, editing, and deleting records, this tool streamlines the process of managing data across multiple tables and databases. The integration of action buttons for managing entries ensures efficient data handling without requiring direct database interactions. Overall, this interface enhances productivity and reduces manual effort when working with seed data.